namespace Brjnk.GpxExplorer.WPF
{
    using System;
    using System.Windows.Data;
    using System.Xml;
    using Brjnk.GpxExplorer.Workspace;

    /// <summary>
    /// </summary>
    public class GeoNamesXmlToCoordinatesConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is XmlElement)
            {
                var info = GeoNamesHelper.GetPlaceInfo(value as XmlElement);
                return info.Position;
            }
            else return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}